//
// Created by HP on 2022/3/8.
//

// std

#include "fontRaster.h"
#include "renderMath.h"

void renderSquare() {
    initScreen();
    Vertex kou1[] = {
            {10.0, 10.0},
            {40.0, 10.0},
            {40.0, 40.0},
            {10.0, 40.0},
            };
    Vertex kou2[] = {
            { 0.0, 0.0},
            {50.0, 0.0},
            {50.0, 50.0},
            { 0.0, 50.0},
            };
    Glyph glyphs[] = {
            {kou1, 4},
            {kou2, 4},
            };
    scanLine(glyphs, sizeof(glyphs) / sizeof(Glyph));
    showScreen(0, "square.bmp");
}

void renderBezier() {
    initScreen();
    Vertex vertices[200];
    BezierQuadratic curve = {
            .p0 = {0.0, 0.0},
            .p1 = {16.0, 32.0},
            .p2 = {32.0, 12.8}
    };
    int v_cnt = 21;
    generate(&curve, vertices, v_cnt);

    Glyph glyph = {
            .vertices = vertices,
            .size = v_cnt,
            };
    scanLine(&glyph, 1);
    showScreen(1, "bezier.bmp");
}

int main() {
    renderSquare();
    renderBezier();
    return 0;
}